﻿<div ng-controller="Deploy.Sdb.Mod.Ctrl" ng-container="{}">
   <div ng-windows="config as ConfigWindows.config" windows-callback="ConfigWindows.callback">
      <div style="height:40px;">
         <select class="form-control" style="width:100px;" ng-model="config.type" ng-change="BuildConfig()">
            <option value="json">JSON</option>
            <option value="xml">XML</option>
         </select>
         <button class="btn btn-primary" ng-click="DownloadConfig()">{{autoLanguage("下载配置")}}</button>
      </div>
      <textarea spellcheck="false" style="font-family:Consolas;font-size:15px;" class="form-control" ng-container="{offsetY:-40}" ng-model="config.text"></textarea>
   </div>
   <div style="border-bottom:1px solid #eee;" step-chart="stepList"></div>
   <div style="padding:10px 15px;" ng-container="{offsetY:-70}">
      <div ng-windows="form as CreateGroupWindow.config" windows-callback="CreateGroupWindow.callback">
         <div form-create para="form"></div>
      </div>
      <div ng-windows="form as RenameGroupWindow.config" windows-callback="RenameGroupWindow.callback">
         <div form-create para="form"></div>
      </div>
      <div ng-windows="form as RemoveNodeWindow.config" windows-callback="RemoveNodeWindow.callback">
         <div form-create para="form"></div>
      </div>
      <div ng-windows="info as HelperWindow.config" windows-callback="HelperWindow.callback">
         <p>
            {{autoLanguage("关于")}}<b>{{autoLanguage("[批量修改节点]")}}</b>{{autoLanguage("。您可以使用特殊规则来")}}<b>{{autoLanguage("批量修改")}}</b>{{autoLanguage("节点的")}}<b>{{autoLanguage("服务名")}}</b>{{autoLanguage("和")}}<b>{{autoLanguage("数据路径：")}}</b>
         </p>
         <table class="table loosen border" style="margin-top:20px;line-height:120%;">
            <tr>
               <td colspan="2" style="width:220px;"><b>{{autoLanguage("服务名规则")}}</b></td>
               <td>{{autoLanguage("规则：服务名[+步进] 或 服务名[-步进]。")}}</td>
            </tr>
            <tr>
               <td>{{autoLanguage("规则")}}</td>
               <td>{{autoLanguage("例子")}}</td>
               <td>{{autoLanguage("描述")}}</td>
            </tr>
            <tr>
               <td>{{autoLanguage("普通方式")}}</td>
               <td>11810</td>
               <td>{{autoLanguage("设置服务名为：11810，但要注意同一主机下的节点是不能有相同服务名。假设有3个节点：PcHost-1:11810，PcHost-2:11810，PcHost-3:11810")}}</td>
            </tr>
            <tr>
               <td>{{autoLanguage("递增方式")}}</td>
               <td>11810[+10]</td>
               <td>{{autoLanguage("设置已选定节点的服务名从11810起始(含11810)，每一个节点递增10。假设有3个节点：PcHost-1:11810，PcHost-2:11820，PcHost-3:11830")}}</td>
            </tr>
            <tr>
               <td>{{autoLanguage("递减方式")}}</td>
               <td>11810[-10]</td>
               <td>{{autoLanguage("设置已选定节点的服务名从11810起始(含11810)，每一个节点递减10。假设有3个节点：PcHost-1:11810，PcHost-2:11800，PcHost-3:11790")}}</td>
            </tr>
         </table>
         <table class="table loosen border" style="margin-top:20px;line-height:120%;">
            <tr>
               <td><b>{{autoLanguage("数据路径规则")}}</b></td>
               <td>{{autoLanguage("规则：可以在路径中任意添加这几个特殊命令，[role] -- 角色，[svcname] -- 服务名，[groupname] -- 分区组名，[hostname] -- 主机名。")}}</td>
            </tr>
            <tr>
               <td>{{autoLanguage("例子")}}</td>
               <td>{{autoLanguage("描述")}}</td>
            </tr>
            <tr>
               <td>/opt/sequoiadb/database/[role]/[svcname]</td>
               <td>{{autoLanguage("假设已选定节点配置为：角色：data，服务名：11810，数据路径将会是：/opt/sequoiadb/database/data/11810，注意：协调节点和编目节点是没有分区组名的，因此当节点是协调节点或编目节点时，[groupname]是空字符。")}}</td>
            </tr>
         </table>
      </div>
      <div ng-container="{offsetY:-45}" ng-if="Configure['DeployMod'] == 'distribution'">
         <div class="pull-left" ng-container="{width:400}">

            <div style="height:30px;font-size:110%;font-weight:bold;">{{autoLanguage("业务")}}: {{ModuleName}}</div>

            <div class="borderBox" style="padding:10px;font-size:90%;" ng-container="{offsetY:-30}">

               <div class="alert alert-info" style="height:32px;" ng-style="{'zh-CN':{'line-height':'32px'}}[Language]">
                  {{autoLanguage("提示：批量配置节点信息说明。详情请点击")}}<a class="linkButton" ng-click="ShowHelper()">{{autoLanguage("帮助")}}</a>
               </div>

               <div style="margin:10px 0;">
                  <button class="btn btn-default" ng-click="ShowCreateGroup()"><i class="fa fa-plus"></i>&nbsp;{{autoLanguage("创建分区组")}}</button>
                  <button class="btn btn-default" ng-click="CreateExportConfigModel()">{{autoLanguage("编辑配置")}}</button>
               </div>

               <div class="borderBox" style="overflow-y:auto;" ng-container="{maxHeight:'100%',offsetY:-105}">

                  <div style="height:55px;border-top:1px solid;" ng-repeat="groupInfo in GroupList track by $index" ng-style="{'true':{'border-color':'#fff'},'false':{'border-color':'#E3E7E8'}}[$index==0]">

                     <div style="height:47px;margin:1px;border:3px solid #fff;" ng-style="{'true':{'border-color':'#80c0ff'},'false':{'border-color':'#fff'}}[groupInfo['checked']==true]">

                        <table class="table" style="margin-top:5px;">
                           <tr>
                              <td style="padding-left:10px;cursor:pointer;" ng-click="SwitchGroup($index)">
                                 <div class="Ellipsis" style="font-weight:bold;">
                                    <span ng-if="groupInfo['role'] == 'coord'">SYSCoord</span>
                                    <span ng-if="groupInfo['role'] == 'catalog'">SYSCatalogGroup</span>
                                    <span ng-if="groupInfo['role'] == 'data'">{{groupInfo['groupName']}}</span>
                                 </div>
                                 <div class="Ellipsis" style="font-size:90%;color:#888;padding-top:3px;">{{autoLanguage("节点数")}}: {{groupInfo['nodeNum']}}</div>
                              </td>
                              <td style="padding-left:10px;width:50px;">
                                 <button class="btn btn-default btn-lg" dropdown-menu="groupInfo['DropdownMenu']">
                                    <span class="caret caret-bottom"></span>
                                 </button>
                              </td>
                           </tr>
                        </table>

                     </div>

                  </div>

               </div>

            </div>

         </div>
         <div class="pull-left" ng-container="{offsetX:-410,marginLeft:10}">

            <div style="height:30px;font-size:110%;font-weight:bold;">{{autoLanguage("节点列表")}}</div>

            <div class="borderBox" style="padding:10px;" ng-container="{offsetY:-30}">

               <div>
                  <button class="btn btn-default" ng-click="SelectAll()">{{autoLanguage("全选")}}</button>
                  <button class="btn btn-default" ng-click="Unselect()">{{autoLanguage("反选")}}</button>
                  <button class="btn btn-default" ng-click="CreateSetNodeConfModel(4,-1,-1,-1,true)">{{autoLanguage("批量修改节点")}}</button>
               </div>

               <div ng-container="{offsetY:-40,marginTop:10}" ng-table="NodeTable['options']" table-title="NodeTable['title']" table-content="nodeInfo in NodeTable['body']" table-callback="NodeTable['callback']">
                  <div table-key="checked">
                     <input type="checkbox" ng-model="nodeInfo.checked" />
                  </div>
                  <div class="Ellipsis" table-key="HostName">
                     <a class="linkButton" ng-click="CreateSetNodeConfModel(3,-1,-1,nodeInfo,true)">{{nodeInfo.HostName}}</a>
                  </div>
                  <div class="Ellipsis" table-key="svcname">
                     <a class="linkButton" ng-click="CreateSetNodeConfModel(3,-1,-1,nodeInfo,true)">{{nodeInfo.svcname}}</a>
                  </div>
                  <div class="Ellipsis" table-key="dbpath">
                     <a class="linkButton" ng-click="CreateSetNodeConfModel(3,-1,-1,nodeInfo,true)">{{nodeInfo.dbpath}}</a>
                  </div>
                  <div class="Ellipsis" table-key="role">
                     <a class="linkButton" ng-click="CreateSetNodeConfModel(3,-1,-1,nodeInfo,true)">{{nodeInfo.role}}</a>
                  </div>
                  <div class="Ellipsis" table-key="datagroupname">
                     <a class="linkButton" ng-click="CreateSetNodeConfModel(3,-1,-1,nodeInfo,true)">{{nodeInfo.datagroupname}}</a>
                  </div>
               </div>

            </div>

         </div>
         <div class="clear-float"></div>
      </div>

      <div ng-container="{offsetY:-45}" ng-if="Configure['DeployMod'] == 'standalone'">
         <div style="height:30px;font-size:110%;font-weight:bold;">{{autoLanguage("业务")}}: {{ModuleName}}</div>
         <div class="underlineTab" style="height:50px;">
            <ul class="left">
               <li ng-class="{true:'active'}[StandaloneShow == 1]">
                  <a class="linkButton" ng-click="SwitchParam(1)">{{autoLanguage("普通")}}</a>
               </li>
               <li ng-class="{true:'active'}[StandaloneShow == 2]">
                  <a class="linkButton" ng-click="SwitchParam(2)">{{autoLanguage("高级")}}</a>
               </li>
               <li ng-class="{true:'active'}[StandaloneShow == 3]">
                  <a class="linkButton" ng-click="SwitchParam(3)">{{autoLanguage("自定义")}}</a>
               </li>
            </ul>
         </div>
         <div class="borderBox" style="padding:10px;overflow-y:auto;position:relative;" ng-container="{offsetY:-80}">
            <div form-create para="StandaloneForm1" ng-show="StandaloneShow == 1"></div>
            <div form-create para="StandaloneForm2" ng-show="StandaloneShow == 2"></div>
            <div form-create para="StandaloneForm3" ng-show="StandaloneShow == 3"></div>
         </div>
      </div>

      <div style="text-align:center;" ng-container="{height:30,marginTop:20}">
         <button class="btn btn-default" ng-click="GotoConf()"><i class="fa fa-chevron-left"></i> {{autoLanguage("上一步")}}</button>
         &nbsp;&nbsp;&nbsp;
         <button class="btn btn-primary" ng-click="GotoInstall()">{{autoLanguage("下一步")}} <i class="fa fa-chevron-right"></i></button>
      </div>

   </div>

</div>
